package cn.com.thread;

import java.util.List;

public class TargetDemo1 extends Thread {

    private List<String> list;

    @Override
    public void run() {
        //获取线程名称
        String threadName = Thread.currentThread().getName();
        for (int i = 0; i < 10; i++) {
            if(threadName.equals("t1") && i == 5){
                this.list.remove(0);
            }
            System.out.println(threadName + "当前list集合：" + this.list);
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }
}
